Add possibility to configure pretty json in .babelish#109
Add possibility to configure pretty json in .babelish#109mateuszszklarek wants to merge 7 commits intonetbe:masterfrom
Conversation
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, {'English' => "en"}, :output_basename => 'output', pretty_json: true) |
There was a problem hiding this comment.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [118/80]
test/babelish/test_csv2json.rb
Outdated
| expected_json_filename = 'test_pretty_json.json' | ||
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
| def test_converting_csv_to_json_with_pretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_pretty_json.json' | ||
| given_json_filename = 'output.json' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
|
|
||
| def test_converting_csv_to_json_with_pretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_pretty_json.json' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, {'English' => "en"}, :output_basename => 'output', pretty_json: false) |
There was a problem hiding this comment.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [119/80]
test/babelish/test_csv2json.rb
Outdated
| expected_json_filename = 'test_unpretty_json.json' | ||
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
| def test_converting_csv_to_json_with_unpretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_unpretty_json.json' | ||
| given_json_filename = 'output.json' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
|
|
||
| def test_converting_csv_to_json_with_unpretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_unpretty_json.json' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2json.rb
Outdated
|
|
||
| def hash_to_output(content = {}) | ||
| return content.to_json | ||
| return @pretty_json ? JSON.pretty_generate(content) : content.to_json |
There was a problem hiding this comment.
Style/RedundantReturn: Redundant return detected.
lib/babelish/commandline.rb
Outdated
| method_option :ignore_lang_path, :type => :boolean, :aliases => "-I", :lazy_default => false, :desc => "Ignore the path component of langs" | ||
| method_option :fetch, :type => :boolean, :desc => "Download file from Google Drive" | ||
| method_option :sheet, :type => :numeric, :desc => "Index of worksheet to download. First index is 0" | ||
| method_option :pretty_json, :type => :boolean, :aliases => "-p", :desc => "Prettify your json output files" |
There was a problem hiding this comment.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [111/80]
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, { "English" => "en" }, output_basename: 'output', pretty_json: true) |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [117/80]
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, { "English" => "en" }, output_basename: 'output', pretty_json: false) |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [118/80]
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
cb319b8 to
aa36473
Compare
| method_option :ignore_lang_path, :type => :boolean, :aliases => "-I", :lazy_default => false, :desc => "Ignore the path component of langs" | ||
| method_option :fetch, :type => :boolean, :desc => "Download file from Google Drive" | ||
| method_option :sheet, :type => :numeric, :desc => "Index of worksheet to download. First index is 0" | ||
| method_option :pretty_json, :type => :boolean, aliases: "-p", desc: "Prettify your json output files" |
There was a problem hiding this comment.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [105/80]
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, | ||
| output_basename: "output", |
There was a problem hiding this comment.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, |
There was a problem hiding this comment.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, |
There was a problem hiding this comment.
Layout/TrailingWhitespace: Trailing whitespace detected.
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, | ||
| output_basename: "output", |
There was a problem hiding this comment.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, |
There was a problem hiding this comment.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, |
There was a problem hiding this comment.
Layout/TrailingWhitespace: Trailing whitespace detected.
@netbe it would be great if you could look at it 🚀